package com.gao.service.impl;

import com.gao.pojo.User;
import com.gao.mapper.UserMapper;
import com.gao.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author GaoHuoHuo
 * @since 2020-03-27
 */
@Service
//如果当前有事务就加入到当前事务  指定异常类回滚
//@Transactional(propagation = Propagation.REQUIRED, rollbackFor = {Exception.class})
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    @Autowired
    private UserMapper userMapper;

    @Override
    public Integer insert(User user) {

        int i = userMapper.insert ( user );

       // i=i/0;

        return i;
    }
}
